package com.kuangjia.student_ems.service;

import com.kuangjia.student_ems.dto.UserDTO;
import com.kuangjia.student_ems.dto.request.UserCreateRequest;
import com.kuangjia.student_ems.dto.request.UserUpdateRequest;
import com.kuangjia.student_ems.entity.User;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

public interface UserService {
    
    UserDTO createUser(UserCreateRequest request);

    UserDTO updateUser(Long userId, UserUpdateRequest request);
    
    void deleteUser(Long userId);

    UserDTO getUserById(Long userId);
    
    List<UserDTO> getAllUsers();
    
    List<UserDTO> getUsersByDepartment(Long departmentId);
    
    List<UserDTO> getUsersByRole(User.UserRole role);

    UserDTO getUserByUsername(String username);
    
    boolean existsByUsername(String username);
    
    List<UserDTO> searchUsers(String keyword);

    /**
     * 分页查询用户
     */
    IPage<UserDTO> getUserPage(Page<User> page, String keyword);

    /**
     * 修改密码，返回是否成功
     */
    boolean changePassword(Long userId, String oldPassword, String newPassword, String email, String emailCode);
} 